package cn.iocoder.yudao.module.shop.dal.mysql.handlestrategy;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.handlestrategy.ShopHandleStrategyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.handlestrategy.vo.*;

/**
 * 手工费结算策略 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopHandleStrategyMapper extends BaseMapperX<ShopHandleStrategyDO> {

    default PageResult<ShopHandleStrategyDO> selectPage(ShopHandleStrategyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopHandleStrategyDO>()
                .eqIfPresent(ShopHandleStrategyDO::getEnabled, reqVO.getEnabled())
                .eqIfPresent(ShopHandleStrategyDO::getTenantId, reqVO.getTenantId())
                .betweenIfPresent(ShopHandleStrategyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopHandleStrategyDO::getId));
    }

    default List<ShopHandleStrategyDO> selectList(ShopHandleStrategyExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopHandleStrategyDO>()
                .eqIfPresent(ShopHandleStrategyDO::getEnabled, reqVO.getEnabled())
                .betweenIfPresent(ShopHandleStrategyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopHandleStrategyDO::getId));
    }

    default List<ShopHandleStrategyDO> selectEnabledList(Long tenantId){
        return selectList(new LambdaQueryWrapperX<ShopHandleStrategyDO>()
                .eq(ShopHandleStrategyDO::getEnabled, true)
                .eq(ShopHandleStrategyDO::getTenantId, tenantId));
    }

}
